<!-- 模板 -->
<template>
  <h3>{{ ts }}</h3>
  <template>{{ ts }}</template>
</template>

<!-- 脚本程序 -->
<script lang="ts" setup>
import {ref, onBeforeUnmount} from 'vue'
const ts = ref(new Date().toLocaleTimeString())
let tt = setInterval(() => {
  ts.value = new Date().toLocaleTimeString()
}, 1000)
//生命周期函数
onBeforeUnmount(() => {
  clearInterval(tt)
})
</script>


<!-- sass 样式，scoped 本组件使用 -->
<!-- npm install sass-loader sass --save-dev -->
<style lang="scss" scoped>

</style>
